'\" -*- coding: UTF-8 -*-
.\" A man page for fstab-decode(8).
.\"
.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved.
.\"
.\" This copyrighted material is made available to anyone wishing to use,
.\" modify, copy, or redistribute it subject to the terms and conditions of the
.\" GNU General Public License v.2.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU General Public License along
.\" with this program; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\" Author: Miloslav Trmac <mitr@redhat.com>
.TH FSTAB-DECODE 8 "May 2006" "sysvinit " "Linux System Administrator's Manual"

.SH NAME
fstab-decode \- run a command with fstab-encoded arguments

.SH SYNOPSIS
.B fstab-decode
.IR COMMAND " [" ARGUMENT " \&.\|.\|.\&]"

.SH DESCRIPTION
.B fstab-decode
decodes escapes (such as newline characters and other whitespace)
in the specified
.IR ARGUMENT s
and uses them to run
.IR COMMAND .
The argument escaping uses the same rules as path escaping in
.IR /etc/fstab ", " /etc/mtab " and " /proc/mtab .

In essence \fBfstab-decode\fR can be used anytime we want to pass multiple
parameters to a command as a list of command line arguments.
It turns output like this:

.nf
/root
/mnt/remote-disk
/home
.fi

Into one long list of parameters, "/root /mnt/remote-disk /home".
This can be useful when trying to work with multiple filesystems at once.
For instance, we can use it to unmount multiple NFS shares.
This program also removes whitespace and
other characters which might cause programs such as
\fBmount\fR(8) or \fBumount\fR(8) to fail.

.SH EXIT STATUS
.B fstab-decode
exits with status 127 if
.I COMMAND
can't be run.
Otherwise it exits with the status returned by
.IR COMMAND .

.SH EXAMPLES
The following example reads
.IR fstab ,
finds all instances of VFAT filesystems
and prints their mount points
(argument 2 in the
.I fstab
file).
.B fstab-decode
then runs the specified program, \fBumount\fR(8), and passes
it the list of VFAT mountpoints.
This unmounts all VFAT partitions.

.nf
.B fstab-decode umount $(awk \[aq]$3 == \[dq]vfat\[dq] { print $2 }\[aq] \
/etc/fstab)
.fi

.SH SEE ALSO
.BR fstab (5)
